import { defineStore } from 'pinia'
import { ref } from 'vue'

export const useStReport = defineStore('stReport', () => {
  const listTech = ref({})
  const listLit = ref({})
  const listPol = ref({})
  const listCadcam = ref({})
  // const sumNaryad = ref(0)
  const uslSum = ref(0)
  const labSum = ref(0)

  const countLoading = ref(0);

  function addUslSum(newUslSum) {
    uslSum.value = uslSum.value + newUslSum
  }

  function addLabSum(newLabSum){
    labSum.value = labSum.value + newLabSum
  }

  function setBrigade(newBrigade) {
    listTech.value = newBrigade.tech
    listLit.value = newBrigade.lit
    listPol.value = newBrigade.pol
    listCadcam.value = newBrigade.cadcam
  }

  function setCountLoading(newCount) {
    countLoading.value = newCount
  }

  function countLoadingDesc() {
    countLoading.value = countLoading.value - 1
  }

  return { listTech, listLit, listPol, listCadcam, setBrigade, addUslSum, addLabSum, uslSum, labSum, setCountLoading, countLoadingDesc, countLoading }
})